package day0224;

abstract public class Animal {
   String name;
   int age;
   String color;

   abstract void eat();
       //System.out.println("你好，年龄为"+age+"的"+name+"正在吃饭");

   void drink(){
       System.out.println("正在喝水，哦哦哦");
   }
   Animal(String name,int age,String color){
       this.name=name;
       this.age=age;
       this.color=color;
   }
}
interface Swim{
    void swim();

}


class  Dog extends Animal implements Swim{
    Dog(String name,int age,String color){
        super(name,age,color);
    }

    @Override
    public void swim() {
        System.out.println(name+"的小狗正咋游泳。");
    }

    @Override
   void eat() {
        System.out.println("名叫"+name+"今年"+age+"颜色为"+color);
    }
    void lookHome(){
        System.out.println("名叫"+name+"的小狗正在看家");
    }
}

class Cat extends Animal{
    Cat(String name,int age,String color){
        super(name,age,color);
    }
    @Override
    void eat() {
        System.out.println(name+"小猫折正在吃猫粮");
    }
    void cats() {
        System.out.println("名叫"+name+"的小猫正在捉"+age+"岁的老鼠");
    }
}

class Fish extends Animal implements Swim{
    Fish(String name,int age,String color){
        super(name,age,color);
    }
    @Override
    void eat() {
        System.out.println("小鱼正在吃鱼粮");
    }
    @Override
    public void swim() {
        System.out.println(name+"正在游泳");
    }
    class Master{
        void feed(Animal animal){
            animal.eat();
            animal.drink();
        }
        void feed(Dog dog){
            dog.eat();
            dog.drink();
        }
    }

}



